package com.ymttest.business.database;

import java.util.Calendar;
import java.util.Date;

import com.ymttest.database.model.YmtUsers;
import com.ymttest.database.sqlwapper.YmtUsersWapper;
import com.ymttest.utils.TestDataManager;

public class CreateUser {
	static YmtUsersWapper ymtu = new YmtUsersWapper();

	public int getMaxUserId() {
		return ymtu.getMaxUserId();
	}

	public int createUser() {
		YmtUsers user = new YmtUsers();
		int UserId = getMaxUserId() + 1;
		user.setIuserid(UserId);
		String uname = "test" + TestDataManager.getRandomNumToHex(4);
		user.setSloginid(uname);
		user.setSpassword("F47C010581713BD523BE9B43677C4872");
		user.setStradingpassword("F47C010581713BD523BE9B43677C4872");
		user.setSloginemail(TestDataManager.getEmail());
		user.setSqq("1234575");
		user.setSnickname("autotest");
		user.setSphone("15200000012");
		user.setScellphone(null);
		user.setSbaseaddress(null);
		user.setSdetailaddress(null);
		user.setDlastlogintime(null);
		user.setItype(0);
		user.setIaction(1);
		Calendar calendar = Calendar.getInstance();
		Date now = calendar.getTime();
		user.setDaddtime(now);
		user.setIsex(2);
		user.setStoken("531E80E472FA6E62A4BC9B9F775E30967282C7193AAAE6E0EB49B64B68E317DB");
		user.setSwang("");
		user.setSmsn("");
		user.setSresetloginpasswordvalidatecode(null);
		user.setFgoodweight(null);
		user.setSlogisticsprovider(null);
		user.setSalipayuserid(null);
		user.setIgroupid(0);
		user.setSresettradingpasswordvalidatecode(null);
		user.setDresetloginpassworddate(null);
		user.setDresettradingpasswordvalidatecodeupdatetime(null);
		user.setIorderwithoutactive(1);
		user.setBlocked(false);
		user.setSuserlogourl("");
		user.setIregsource(0);
		user.setSidcardno("110101140101669");
		user.setIvisitlan(null);
		user.setIchannelsource(5);
		user.setIterminalsource(null);
		user.setDloginsendgifttime(now);
		ymtu.createUser(user);
		return UserId;
	}

	public static void main(String[] args) {
		CreateUser test = new CreateUser();
		test.createUser();
	}
}
